﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="FeedbackView.aspx.cs" Inherits="FeedbackWebClient.FeedbackView" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel runat="server" ID="up">
        <ContentTemplate>
            <div class="feedViewToolbar">
                <span>Sort By</span>
                <asp:DropDownList runat="server" ID="ddlSortBy" AutoPostBack="true" OnSelectedIndexChanged="ddlSortBy_SelectedIndexChanged" />
                <div class="inlineDisplay feedbackButton">
                    <asp:Button runat="server" Text="Positive feedback" ID="btnPositiveFeedback" OnClick="btnPositiveFeedback_Click" />
                    <asp:Button runat="server" Text="Negative feedback" ID="btnNegativeFeedback" OnClick="btnNegativeFeedback_Click" />
                </div>
                <div class="inlineDisplay rightFloat">
                    <asp:Button runat="server" Text="Block" ID="btnBlockFeedback" OnClick="btnBlockFeedback_Click" />
                    <asp:Button runat="server" Text="Delete" ID="btnDeleteFeedback" OnClick="btnDeleteFeedback_Click" />
                </div>
            </div>
            <div class="clear">
            </div>
            <div>
                <div id="dvFeedback">
                    <asp:Repeater runat="server" ID="rptFeedback">
                        <ItemTemplate>
                            <div class="singlefeedbackRow" id="dv<%# Eval("Id")%>">
                                <div class="inlineDisplay feedbackCell feedbackCell1 ">
                                    <asp:CheckBox runat="server" ID="chkSelector" />
                                    <asp:HiddenField runat="server" ID="hfFeedback" Value='<%# Eval("Id")%>' />
                                </div>
                                <div class="inlineDisplay feedbackCell2">
                                    <div class="feedbackPropertyDisplay feedbackAction" style="margin-bottom: 10px;">
                                        image
                                    </div>
                                    <div class="feedbackPropertyDisplay feedbackAction">
                                        <div onclick="showMerge(<%# Eval("Id")%>)" class="mergeAction" onmousemove="this.style.cursor='hand'">
                                            <span class="mergeCount"><%#Eval("MergeFeedbackCount")%></span> Merge
                                        </div>
                                    </div>
                                </div>
                                <div class="inlineDisplay feedbackCell3">
                                    <div class="feedbackTextDisplay feedbackPropertyDisplay" style="margin-bottom: 10px;">
                                        <%# DataBinder.Eval(Container.DataItem, "ReceivedDate", "{0:dd MMM yyyy}")%>
                                    </div>
                                    <div class="feedbackTextDisplay feedbackPropertyDisplay">
                                        email@email.com
                                    </div>
                                </div>
                                <div class="inlineDisplay feedbackCell4">
                                    <div class="feedbackMessage feedbackTextDisplay">
                                        <%# Eval("Message")%>
                                    </div>
                                </div>
                            </div>
                            <%# Convert.ToInt32(Eval("MergeFeedbackCount")) <= 0 ? "" : string.Format("<div onclick='toggleMergeFeedback({1}, this)'  class='mergeItem mergeItemHeader'>+{0} similar feedbacks</div>", Eval("MergeFeedbackCount"), Eval("Id"))%>
                            <div id="dvMergeContainer<%# Eval("Id")%>" style="display:none;" >
                                <asp:Repeater runat="server" DataSource='<%# Eval("MergeFeedbackList")%>'>
                                    <ItemTemplate>
                                        <div class="singlefeedbackRow mergeItem mergeItemDetail" id="dvMerge<%# Eval("Id")%>">
                                            <div class="inlineDisplay feedbackCell feedbackCell1">
                                            </div>
                                            <div class="inlineDisplay feedbackCell2">
                                                <div class="feedbackPropertyDisplay feedbackAction" style="margin-bottom: 10px;">
                                                    image
                                                </div>
                                                <div class="feedbackPropertyDisplay feedbackAction">
                                                    <div class="mergeAction" onmousemove="this.style.cursor='hand'">
                                                        <span class="mergeCount">0</span> Merge
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="inlineDisplay feedbackCell3">
                                                <div class="feedbackTextDisplay feedbackPropertyDisplay" style="margin-bottom: 10px;">
                                                    <%# DataBinder.Eval(Container.DataItem, "ReceivedDate", "{0:dd MMM yyyy}")%>
                                                </div>
                                                <div class="feedbackTextDisplay feedbackPropertyDisplay">
                                                    email@email.com
                                                </div>
                                            </div>
                                            <div class="inlineDisplay feedbackCell4">
                                                <div class="feedbackMessage feedbackTextDisplay">
                                                    <%# Eval("Message")%>
                                                </div>
                                            </div>
                                        </div>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </div>
                        </ItemTemplate>
                    </asp:Repeater>
                </div>
            </div>
            <asp:Button runat="server" OnClick="btnRefresh_Click" ID="btnRefresh" style="display:none"  />
        </ContentTemplate>
    </asp:UpdatePanel>
    <div id="dvfeebackMerge" style="display: none;">
        <div id="fmItem">
        </div>
        <div>
            Select similar feedback
        </div>
        <div id="fmItemAll">
        </div>
        <div>
            <input type="button" value="Save" onclick="saveMerge()" />
        </div>
    </div>
    <script src="js/Feedback.js" type="text/javascript"></script>
    <script type="text/javascript">
        function updateFeedback() {
            $('#<%= btnRefresh.ClientID %>').click();
        }
    </script>
</asp:Content>
